<template>
    <el-tag v-if="dictname">{{ dictname }}</el-tag>
    <el-tag v-else>2</el-tag>
    

</template>


<script setup>

import usedictStore from '@/store/app/dict';
import { computed, onMounted } from 'vue';
const dictStore = usedictStore();

const dictname = ref('');

const props = defineProps({
    dictcode: {
        type: [String,Number],
        require: true,
    },

    classCode: {
        type: String,
        require: true
    }
});

onMounted( async()=>{
    const res =await  dictStore.getDictDataCache(props.classCode);
    if (res.data && res.data.data) {
        var targetItem = res.data.data.find(item => item.code == props.dictcode);
        if (targetItem) { 
            dictname.value = targetItem.name;
            return;
        }
    }
});

</script>
